<template>
    <div>
        <h3>登录</h3>
        <table class="table">
            <tbody>
                <tr>
                    <td>会员名称</td>
                    <td>
                        <input type="text" v-model="data.zh"> 
                    </td>
                </tr>
                <tr>
                    <td>年龄</td>
                    <td>
                        <input type="password" v-model="data.mm">
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <input type="button" value="登录" @click="add">
                    </td>
                </tr>
            </tbody>
        </table>

    </div>
</template>

<script setup lang="ts">
import axios from 'axios';
import { ref } from 'vue';

const data=ref({
    zh:"",
    mm:"",
})



 const add=()=>{
    axios.get("https://localhost:7267/api/dl/login",{params:data.value}).then(res=>{
        if(res.data==1){
            alert("登录成功");
            location.href ="/hyxs"
        }
        if(res.data==-1){
            alert("密码错误");

        }
        if(res.data==-2){
            alert("账号不正确");
      
        }
    })
 }

</script>

<style scoped>

</style>